package rad.framework.mda.generator.template.main.application.metainf;

import org.eclipse.uml2.uml.Model;

public class Application
{
  protected static String nl;
  public static synchronized Application create(String lineSeparator)
  {
    nl = lineSeparator;
    Application result = new Application();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + NL + "<application xmlns=\"http://java.sun.com/xml/ns/javaee\"" + NL + "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + NL + "\txsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd\"" + NL + "\tversion=\"5\">" + NL + "\t" + NL + "\t<display-name>";
  protected final String TEXT_2 = "</display-name>" + NL + "" + NL + "\t<module>" + NL + "\t\t<ejb>jboss-seam-${seam.version}.jar</ejb>" + NL + "\t</module>" + NL + "\t<module>" + NL + "\t\t<ejb>";
  protected final String TEXT_3 = "-jpa-${project.version}.jar</ejb>" + NL + "\t</module>" + NL + "\t<module>" + NL + "\t\t<ejb>";
  protected final String TEXT_4 = "-ejb-${project.version}.jar</ejb>" + NL + "\t</module>" + NL + "\t<module>" + NL + "\t\t<ejb>";
  protected final String TEXT_5 = "-jsf-${project.version}.jar</ejb>" + NL + "\t</module>" + NL + "" + NL + "\t<module>" + NL + "\t\t<web>" + NL + "\t\t\t<web-uri>";
  protected final String TEXT_6 = "-web-${project.version}.war</web-uri>" + NL + "\t\t\t<context-root>/";
  protected final String TEXT_7 = "</context-root>" + NL + "\t\t</web>" + NL + "\t</module>" + NL + "\t" + NL + "\t<library-directory>lib</library-directory>" + NL + "\t" + NL + "</application>";

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    

    Model uml2Model = (Model) argument;
    stringBuffer.append(TEXT_1);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_2);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_3);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_4);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_5);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_6);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_7);
    return stringBuffer.toString();
  }
}
